package com.mall.auth.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.mall.auth.api.IAuthApi;
import com.mall.auth.entity.param.OauthClientDetailsAddParam;
import com.mall.auth.entity.po.OauthClientDetails;
import com.mall.auth.mapper.OauthClientDetailsMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author wuyijie
 * @description: TODO
 * @date 2021/6/28 15:32
 */
@Service
@Slf4j
public class AuthApiImpl implements IAuthApi {
    @Autowired
    private OauthClientDetailsMapper oauthClientDetailsMapper;

    @Override
    public int addOauthCilentDetails(OauthClientDetailsAddParam oauthClientDetailsAddParam) {
        int add = 0;
        try {
            OauthClientDetails oauthClientDetails = BeanUtil.toBean(oauthClientDetailsAddParam, OauthClientDetails.class);
            add = oauthClientDetailsMapper.insert(oauthClientDetails);
        } catch (Exception e) {
            log.error("业务异常：", e);
        }
        return add;


    }
}
